/**
 *                            License
 * THE WORK (AS DEFINED BELOW) IS PROVIDED UNDER THE TERMS OF THIS  
 * CREATIVE COMMONS PUBLIC LICENSE ("CCPL" OR "LICENSE"). 
 * THE WORK IS PROTECTED BY COPYRIGHT AND/OR OTHER APPLICABLE LAW.  
 * ANY USE OF THE WORK OTHER THAN AS AUTHORIZED UNDER THIS LICENSE OR  
 * COPYRIGHT LAW IS PROHIBITED.
 * 
 * BY EXERCISING ANY RIGHTS TO THE WORK PROVIDED HERE, YOU ACCEPT AND  
 * AGREE TO BE BOUND BY THE TERMS OF THIS LICENSE. TO THE EXTENT THIS LICENSE  
 * MAY BE CONSIDERED TO BE A CONTRACT,
 * THE LICENSOR GRANTS YOU THE RIGHTS CONTAINED 
 * HERE IN CONSIDERATION OF YOUR ACCEPTANCE OF SUCH TERMS AND CONDITIONS.
 * 
 */
package com.lineage.server.packetclient;

import java.util.logging.Level;
import java.util.logging.Logger;

import com.lineage.server.ClientThread;
import com.lineage.server.model.Instance.L1PcInstance;

/**
 * Class <code>C_CharSelectionScreen</code> 返回角色选择画面&离线.
 * 
 * @author jrwz
 * @version 2012-7-29上午07:02:43
 * @see com.lineage.server.packetclient
 * @since JDK1.7
 */
public final class C_CharSelectionScreen extends ClientBasePacket {
    /** 返回一个字符串，表示客户端的数据包类型. */
    private static final String C_CHAR_SELECTION_SCREEN = "[C] C_CharSelectionScreen";
    /** 提示信息. */
    private static final Logger LOG = Logger
            .getLogger(C_CharSelectionScreen.class.getName());

    /**
     * 返回角色选择画面&离线.
     * 
     * @param abyte0
     *            - 资料
     * @param client
     *            - 客户端对象
     */
    public C_CharSelectionScreen(final byte[] abyte0, final ClientThread client) {
        super(abyte0);
        final L1PcInstance pc = client.getActiveChar();
        if (pc == null) {
            return;
        }
        try {
            // XXX 待实作 小退与大退均会发送一次
            // LOG.info("回到角色选择画面(角色) : " + pc.getName());
            // ClientThread.quitGame(pc);
            // synchronized (pc) {
            // pc.logout();
            // client.setActiveChar(null);
            // }
            // ServerManager.list.remove(pc.getName());
        } catch (final Exception e) {
            LOG.log(Level.SEVERE, e.getLocalizedMessage(), e);
        }
    }

    @Override
    public String getType() {
        return C_CHAR_SELECTION_SCREEN;
    }
}
